package com.byinsight.web.actions.expense;

import java.util.Date;
import java.util.List;

import com.byinsight.service.dto.Expense;
import com.byinsight.web.actions.CheckSessionAction;
import com.byinsight.web.actions.util.DateUtil;
import com.byinsight.web.actions.util.ExpenseHelper;

public class GetDailyExpenseAction extends CheckSessionAction {
	private static final long serialVersionUID = 7236386322577822494L;
	
	private String date;
	
	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	@Override
	protected String process() {
		Date d = DateUtil.StringToDate(date);
		List<Expense> expenses = expenseService.findDaily(d);
		String ret = ExpenseHelper.toXml(expenses);
		return ret;
	}

}
